package ctrLag;
import modelLag.*;

/**
 * Write a description of class Kunde here.
 * 
 * @author (Anders Mortensen) 
 * @version (1.0 03-11-14)
 */
public class PersonCtr {
    // instance variables 
    private PersonContainer pCon;

    /**
     * Constructor for objects of class Kunde
     */
    public PersonCtr() {
        pCon = PersonContainer.getInstance();
    }

    /**
     * An example of a method - replace this comment with your own
     * 
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y 
     */
    public void addPerson(String name, String address, String city, int postalCode, String phone) {
        Person per = new Person(name,address,city,postalCode,phone);
        pCon.addPerson(per);
    }
    
    public Person findPer(String phone) {
        Person per = pCon.findPerson(phone);
        return per;
    }
    
    public void deletePerson(String phone) {
        pCon.deletePerson(phone);
    }
    
    public void updatePerson(Person per, String newName, String newAddress, int newPostalCode, String newCity, String newPhone) {
        per.setName(newName);
        per.setAddress(newAddress);
        per.setPostalCode(newPostalCode);
        per.setCity(newCity);
        per.setPhone(newPhone);
    }
}













